<template>
  <div class="content">
    <div class="left">
      <div class="logo">
        <img src="@/assets/3d_icon//logo.png" alt="" />
      </div>
      <div class="header-txt">3D可视化编辑器</div>
    </div>
    <div class="right">
      <div class="save-box">
        <img class="save-pic" src="@/assets//3d_icon//save.png" alt="" />
        <span class="save-txt">保存场景</span>
      </div>
      <div class="btn-box">
        <img
          v-if="$store.state.theme === 'light'"
          @click="toggleSwitch"
          src="@/assets/3d_icon/evening_icon.png"
          alt=""
        />
        <img v-else @click="toggleSwitch" src="@/assets/3d_icon/day_icon.png" alt="" />
      </div>
      <div class="user-box">
        <img class="user-pic" src="@/assets//3d_icon/user.png" alt="" />
        <span class="user-name">Admin</span>
        <a-icon type="caret-down" style="color: rgba(255, 255, 255, 1)" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "Header",
  data() {
    return {};
  },
  methods: {
    //切换主题
    toggleSwitch() {
      if (this.$store.state.theme === "light") {
        this.$store.commit("setTheme", "dark");
      } else {
        this.$store.commit("setTheme", "light");
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.content {
  height: 64px;
  // background-color: #2a3241;
  background-color: var(--bgc);
  padding: 0 17px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  justify-content: space-between;

  .left {
    width: 50%;
    display: flex;
    align-items: center;

    .logo {
      width: 35px;
      height: 35px;

      img {
        width: 100%;
        height: 100%;
      }
    }

    .header-txt {
      color: #fff;
      font-size: 20px;
      font-family: DOUYU;
      font-weight: normal;
      margin-left: 12px;
    }
  }

  .right {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: flex-end;

    .save-box {
      width: 106px;
      height: 36px;
      background: var(--save-btn);
      border-radius: 4px;
      display: flex;
      align-items: center;

      .save-pic {
        width: 18px;
        height: 18px;
        margin: 0 5px 0 10px;
      }

      .save-txt {
        font-size: 16px;
        font-family: Source Han Sans CN;
        font-weight: 300;
        color: #fff;
      }
    }

    .btn-box {
      margin: 0 60px;
      width: 65px;
      height: 33px;

      img {
        width: 100%;
        height: 100%;
        cursor: pointer;
      }
    }

    .user-box {
      display: flex;
      align-items: center;

      .user-pic {
        width: 27px;
        height: 28px;
      }

      .user-name {
        margin: 0 3px 0 8px;
        font-size: 16px;
        font-family: Source Han Sans CN;
        font-weight: 500;
        color: #fff;
      }
      >>> .anticon {
        font-size: 28px;
      }
    }
  }
}
</style>
